//
//  ViewController.m
//  TinyFortune
//
//  Created by lc on 16/5/15.
//  Copyright © 2016年 lc. All rights reserved.
//

#import "ViewController.h"
#import "LCTabController.h"
#import "myViewController.h"
#import "DiscoveryViewController.h"
#import "MessageViewController.h"
#import "TinyFortuneViewController.h"
#import "welcomeViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
}

- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
        
    //1.创建标签栏控制器
    LCTabController *tabBarController = [LCTabController new];
    //2.创建管理视图控制器
    TinyFortuneViewController *tin = [TinyFortuneViewController new];
    UINavigationController *tinNav = [[UINavigationController alloc]initWithRootViewController:tin];
    MessageViewController *message = [MessageViewController new];
    UINavigationController *messageNav = [[UINavigationController alloc]initWithRootViewController:message];
    DiscoveryViewController *dis = [DiscoveryViewController new];
   UINavigationController *disNav = [[UINavigationController alloc]initWithRootViewController:dis];
   
        UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    //根据storyBoard ID创建根视图控制器
    myViewController *my = [sb instantiateViewControllerWithIdentifier:@"myViewController"];
    UINavigationController *myNav = [[UINavigationController alloc]initWithRootViewController:my];
    
    
    [tabBarController addController:tinNav WithTitle:@"小幸运" imageName:@"huiben_new" selectedImageName:@"huiben_d"];
    [tabBarController addController:messageNav WithTitle:@"消息" imageName:@"zhuanti_new" selectedImageName:@"zhuanti_d"];
    [tabBarController addController:disNav WithTitle:@"发现" imageName:@"faxian_u" selectedImageName:@"faxian_d"];
  [tabBarController addController:myNav WithTitle:@"我" imageName:@"wode_u" selectedImageName:@"wode_d"];
    
    
    //作为window的跟视图控制器
   
    //self.view.window.rootViewController = tabBarController;
    
    welcomeViewController *wel = [welcomeViewController new];
    //[self presentViewController:wel animated:YES completion:nil];
     self.view.window.rootViewController = wel ;
    wel.tabController = tabBarController;

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
